package com.mj.listen1._04队列;

import com.mj.listen1._04队列.list.LinkList;
import com.mj.listen1._04队列.list.List;

/**
 * 使用链表实现队列
 *
 * @param <E>
 */
public class MyQueue<E> implements Queue<E> {

    private List<E> list = new LinkList<>();

    @Override
    public int size() {
        return list.size();
    }

    @Override
    public boolean isEmpty() {
        return list.isEmpty();
    }

    @Override
    public void clear() {
        list.clear();
    }

    @Override
    public void enQueue(E element) {
        list.add(element);
    }

    @Override
    public E deQueue() {
        return list.remove(0);
    }

    @Override
    public E front() {
        return list.get(0);
    }
}
